package API;
//本类用于测试包装类

public class TestNumber {
    static Integer i0;
    public static void main(String[] args) {
        System.out.println(i0);//默认值为null
        Integer i1 = new Integer(5);
        Integer i11 = new Integer(5);
        System.out.println(i1 == i11);
        //Integer常量池为-128-127.
        Integer i2 = Integer.valueOf(5);
        //满足高效的三个条件：IntegervalueOf -128-127
        Integer i4 = Integer.valueOf(300);
        Integer i5 = Integer.valueOf(300);
        Integer i3 = Integer.valueOf(127);
        System.out.println(i1 == i2);
        System.out.println(i2 == i3);
        System.out.println(i4 == i5);


        Double d = new Double(3.14);
        //只有Integer才有高效的效果
        Double d1 =Double.valueOf(3.14);
        Double d2 =Double.valueOf(3.14);
        System.out.println(d == d1);
        System.out.println(d1 == d2);
        System.out.println();





    }
}
